Anaerobic Digester block
Activated Sludge model to Anaerobic Digester model (ASM2ADM)
The purpose of ASM2ADM is to transform the state variables from the activated sludge section corresponding to the ASM formulation into state variables usable in the AD.
Input
- Mixing flow from:
- underflow of the primary clarifier
- thickened secondary sludge wasted from the secondary clarifier (settler) (underflow from thickener)
- Input State (ASM state variables) (unit: g CODm^-3 or g N m^-3 for variable with N or mole HCO3-*m^-3 for Salk):
- Soluble: Si, Ss, So, Sno, Snh, Snd, Salk
- Particulate: Xi, Xs, Xbh, Xba, Xp, Xnd
- Other inputs:
- Q
- T
- TSS-load (store in Particulate[6] with the first index = 0)
- pH from ADM1 model (pH_adm)
Parameter
The parameters are stored in INTERFACEPAR variable in MATLAB
| index | Parameter | Description | Value | Unit | Note |
|---|---|---|---|---|---|
| 0 | CODequiv | 2.857143 | |||
| 1 | fnaa | Fraction of N in amino acids and Xpr | 0.098 | ||
| 2 | fnxc | N content of composite material based on BSM2 | 0.0376 | ||
| 3 | fnbac | N content of biomass based on BSM1 | 0.08 | same in AS and AD | |
| 4 | fxni | N content of inerts XI and XP | 0.06 | same in AS and AD | |
| 5 | fsni | N content of SI | 0 | assumed zero in ASM1 and BSM1 | |
| 6 | fsni_adm | N content of SI in the AD system | 0.06 | ||
| 7 | frlixs | lipid fraction of non-nitrogenous Xs | 0.7 | ||
| 8 | frlibac | lipid fraction of non-nitrogenous biomass | 0.4 | ||
| 9 | frxs_adm | anaerobically degradable fraction of AS biomass | 0.68 | ||
| 10 | fdegrade_adm | amount of AS XI and XP degradable in AD | 0 | zero in BSM2 | |
| 11 | frxs_as | aerobically degradable fraction of AD biomass | 0.79 | Not used in ASM2ADM | |
| 12 | fdegrade_as | amount of AD XI and XP degradable in AS | 0 | Not used in ASM2ADM, zero in BSM2 | |
| 13 | R | universal gas constant | 0.083145 | dm3*bar/(mol*K) | |
| 14 | T_base | base temperature (25 degC in K) | 298.15 | K | |
| 15 | T_op | operational temperature of AD and interface (35 degC in T) | 308.15 | K | Should be an input variable if dynamic temperature control is used |
| 16 | pK_w_base | 14 | |||
| 17 | pK_a_va_base | 4.86 | |||
| 18 | pK_a_bu_base | 4.82 | |||
| 19 | pK_a_pro_base | 4.88 | |||
| 20 | pK_a_ac_base | 4.76 | |||
| 21 | pK_a_co2_base | 6.35 | |||
| 22 | pK_IN_base | 9.25 |
Transform state variables (Z) from AS to AD
- Z_AS = Mixing flow from the two inputs
- Temperature in AD = 35 degree celsius
- The equation is based on temperature at 25 degree celsius
- Convert pKa (T=25) to pKa (T=35)
Output
Output ports (Collimator model)
- Q (y[26])
- T (y[27])
- y_output (y[0:25] describe in point 2)
y is the output in ADM1 terminology + extra dummy states, 33 variables as describe in Matlab model
- y[0] : Ssu = monosacharides (kg COD/m3)
- y[1] : Saa = amino acids (kg COD/m3)
- y[2] : Sfa = long chain fatty acids (LCFA) (kg COD/m3)
- y[3] : Sva = total valerate (kg COD/m3)
- y[4] : Sbu = total butyrate (kg COD/m3)
- y[5] : Spro = total propionate (kg COD/m3)
- y[6] : Sac = total acetate (kg COD/m3)
- y[7] : Sh2 = hydrogen gas (kg COD/m3)
- y[8] : Sch4 = methane gas (kg COD/m3)
- y[9] : Sic = inorganic carbon (kmole C/m3)
- y[10] : Sin = inorganic nitrogen (kmole N/m3)
- y[11] : Si = soluble inerts (kg COD/m3)
- y[12] : Xxc = composites (kg COD/m3)
- y[13] : Xch = carbohydrates (kg COD/m3)
- y[14] : Xpr = proteins (kg COD/m3)
- y[15] : Xli = lipids (kg COD/m3)
- y[16] : Xsu = sugar degraders (kg COD/m3)
- y[17] : Xaa = amino acid degraders (kg COD/m3)
- y[18] : Xfa = LCFA degraders (kg COD/m3)
- y[19] : Xc4 = valerate and butyrate degraders (kg COD/m3)
- y[20] : Xpro = propionate degraders (kg COD/m3)
- y[21] : Xac = acetate degraders (kg COD/m3)
- y[22] : Xh2 = hydrogen degraders (kg COD/m3)
- y[23] : Xi = particulate inerts (kg COD/m3)
- y[24] : scat+ = cations (metallic ions, strong base) (kmole/m3)
- y[25] : san- = anions (metallic ions, strong acid) (kmole/m3)
- y[26] : flow rate (m3/d) (put in separate port for Collimator model)
- y[27] : temperature (deg C) (put in separate port for Collimator model)
- y[28:32] : dummy states for future use (omit from Collimator model)
Anaerobic Digester model
ADM1
Input
- Q, T, y_output from ASM2ADM block (u[0:32] 33 variables in Matlab; 28 in collimator)
- Output from pH solver (7) (u[33:39] 7 variables in Matlab; )
- Output from Sh2 solver (1) (u[40] 1 variable in Matlab; )
Parameters
- Input Parameters
- DIGESTERINIT (42)
- DIGESTERPAR (100)
- DIM_D (2)
- V_liq = 3400 m3 size of BSM2 AD
- V_gas = 300 m3 size of BSM2 AD
- Calculated Parameters
- factor = (1.0/T_base - 1.0/T_op)/(100.0*R);
- K_H_h2 = K_H_h2_baseexp(-4180.0factor); /T adjustment for K_H_h2/
- K_H_ch4 = K_H_ch4_baseexp(-14240.0factor); /T adjustment for K_H_ch4/
- K_H_co2 = K_H_co2_baseexp(-19410.0factor); /T adjustment for K_H_co2/
- K_w = pow(10,-pK_w_base)exp(55900.0factor); / T adjustment for K_w /
- p_gas_h2o = K_H_h2o_baseexp(5290.0(1.0/T_base - 1.0/T_op)); /* T adjustment for water vapour saturation pressure
- ...
- Variables from input
- S_H_ion = u[33] H+
- pH_op = -log10*(u[33]) pH
State variables
- Temporary state variables (xtemp[i]) (42 variables) (index is according to Matlab model)
- index [0:25] is corresponding to state variables input from ASM2ADM block
- index [26:31] is corresponding to state variables input from pH solver
- index [32:34] is corresponding to state of gas variables in AD
- index [35] is corresponding to flow rate
- index [36] is corresponding to temperature in deg C
- index [37:41] is corresponding to dummy variables (omit from collimator)
Output
Output ports = 52 in Matlab and 47 in Collimator x[i] = state of i variable
- Q_output = Q_input flow rate (m3/d) (put in separate port for Collimator model)
- T_output = T_op - 273.15 temperature (deg C) (put in separate port for Collimator model)
- Omit dummy variables: y[28:32] dummy states for future use (omit from Collimator model)
- y[0] : Ssu = x[0] monosacharides (kg COD/m3)
- y[1] : Saa = x[1] amino acids (kg COD/m3)
- y[2] : Sfa = x[2] long chain fatty acids (LCFA) (kg COD/m3)
- y[3] : Sva = x[3] total valerate (kg COD/m3)
- y[4] : Sbu = x[4] total butyrate (kg COD/m3)
- y[5] : Spro = x[5] total propionate (kg COD/m3)
- y[6] : Sac = x[6] total acetate (kg COD/m3)
- y[7] : Sh2 = u[40] = input from Sh2 port hydrogen gas (kg COD/m3)
- y[8] : Sch4 = x[8] methane gas (kg COD/m3)
- y[9] : Sic = x[9] inorganic carbon (kmole C/m3)
- y[10] : Sin = x[10] inorganic nitrogen (kmole N/m3)
- y[11] : Si = x[11] soluble inerts (kg COD/m3)
- y[12] : Xxc = x[12] composites (kg COD/m3)
- y[13] : Xch = x[13] carbohydrates (kg COD/m3)
- y[14] : Xpr = x[14] proteins (kg COD/m3)
- y[15] : Xli = x[15] lipids (kg COD/m3)
- y[16] : Xsu = x[16] sugar degraders (kg COD/m3)
- y[17] : Xaa = x[17] amino acid degraders (kg COD/m3)
- y[18] : Xfa = x[18] LCFA degraders (kg COD/m3)
- y[19] : Xc4 = x[19] valerate and butyrate degraders (kg COD/m3)
- y[20] : Xpro = x[20] propionate degraders (kg COD/m3)
- y[21] : Xac = x[21] acetate degraders (kg COD/m3)
- y[22] : Xh2 = x[22] hydrogen degraders (kg COD/m3)
- y[23] : Xi = x[23] particulate inerts (kg COD/m3)
- y[24] : scat+ = x[24] cations (metallic ions, strong base) (kmole/m3)
- y[25] : san- = x[25] anions (metallic ions, strong acid) (kmole/m3)
- Output corresponding to pH solver block
- y[33] (y[26] in collimator): ph_op = -log10(u[33]) (u[33] = pH_solver_input[0]) pH
- y[34] (y[27] in collimator): u[33] (u[33] = pH_solver_input[0]) SH+
- y[35] (y[28] in collimator): u[34] (u[34] = pH_solver_input[1]) Sva-
- y[36] (y[29] in collimator): u[35] (u[35] = pH_solver_input[2]) Sbu-
- y[37] (y[30] in collimator): u[36] (u[36] = pH_solver_input[3]) Spro-
- y[38] (y[31] in collimator): u[37] (u[37] = pH_solver_input[4]) Sac-
- y[39] (y[32] in collimator): u[38] (u[38] = pH_solver_input[5]) SHCO3-
- y[40] (y[33] in collimator): x[9] - u[38] (u[38] = pH_solver_input[5]) SCO2
- y[41] (y[34] in collimator): u[39] (u[39] = pH_solver_input[6]) SNH3
- y[42] (y[35] in collimator): x[10]-u[39] (u[39] = pH_solver_input[6]) SNH4+
- Sgas
- y[43] (y[36] in collimator): x[32] Sgas, h2
- y[44] (y[37] in collimator): x[33] Sgas, ch4
- y[45] (y[38] in collimator): x[34] Sgas, co2
- y[46] (y[39] in collimator): p_gas_h2 = x[32]RT_op/16.0
- y[47] (y[40] in collimator): p_gas_ch4 = x[33]RT_op/64.0
- y[48] (y[41] in collimator): p_gas_co2 = x[34]RT_op
- y[49] (y[42] in collimator): P_gas = p_gas_h2 + p_gas_ch4 + p_gas_co2 + p_gas_h20
- y[50] (y[43] in collimator): q_gas * P_gas/P_atm
- q_gas = max(0, k_P*(P_gas - P_atm))
- k_P and P_atm = input parameter
- y[51] (omit from collimator): u[7] We combine the Sh2 calculation in the ODE instead of having a separate one like in Matlab. #Sh2 output from ASM2ADM block
Sh2 solver
Stiffness of the ADM1 can be reduced by approximating the differential equations of the pH and Sh2 states by algebraic equation
- Gradient equation:
- State_input[2] = Sfa = x[2] = Soluble_xtemp[2]
- State_input[18] = Xfa = x[18] = Particulate_xtemp[6]
- State_input[10] = Sin = x[10] = Soluble_xtemp[10]
- State_input[3] = Sva = x[3] = Soluble_xtemp[3]
- State_input[19] = Xc4 = x[19] = Particulate_xtemp[7]
- State_input[4] = Sbu = x[4] = Soluble_xtemp[4]
- State_input[5] = Spro = x[5] = Soluble_xtemp[5]
- State_input[20] = Xpro = x[20] = Particulate_xtemp[8]
- State_input[22] = Xh2 = x[22] = Particulate_xtemp[10]
pH solver
- Need to fix pH solver
- create ODE for each variable
- DAE:
- SH+ equation:
- SH+ = State_input[24]+(State_input[10]-var[6])+var[0]-var[5]-var[4]/64-var[3]/112-var[2]/160-var[1]/208-K_w/var[0]-State_input[25]
- var[0] = SH+
- State_input[24] = scat+
- State_input[10] = Sin
- State_input[9] = Sic
- State_input[6] = Sac
- State_input[5] = Spro
- State_input[4] = Sbu
- State_input[3] = Sva
- State_input[25] = san-
- var[6] = SNH3 = K_a_IN*State_input[10]/(K_a_IN+var[0])
- var[5] = SHCO3- = K_a_co2*State_input[9]/(K_a_co2+var[0])
- var[4] = Sac- = K_a_ac*State_input[6]/(K_a_ac+var[0])
- var[3] = Spro- = K_a_pro*State_input[5]/(K_a_pro+var[0])
- var[2] = Sbu- = K_a_bu*State_input[4]/(K_a_bu+var[0])
- var[1] = Sva- = K_a_va*State_input[3]/(K_a_va+var[0])
- SH+ = State_input[24]+(State_input[10]-var[6])+var[0]-var[5]-var[4]/64-var[3]/112-var[2]/160-var[1]/208-K_w/var[0]-State_input[25]
- SH+ equation:
- ODE:
- SH+ equation:
- SH+ = State_input[24]+(State_input[10]-var[6])+var[0]-var[5]-var[4]/64-var[3]/112-var[2]/160-var[1]/208-K_w/var[0]-State_input[25]
- var[1] = = - =
- var[2] = = - =
- var[3] = = - =
- var[4] = = - =
- var[5] = = - =
- var[6] = = - =
- SH+ equation:
Mapping output
- There is a room of improvement
- pH will need to be calculated and stored as output
Anaerobic Digester model to Activated Sludge model
Input
u is the input in ADM1 terminology + extra dummy states, 33 variables
- Q: flow rate (m3/d) (u[26] in matlab)
- T: ADM temperature (deg C) (u[27] in matlab)
- State variables (only use u[0:26])
- u[0] : Ssu = monosacharides (kg COD/m3)
- u[1] : Saa = amino acids (kg COD/m3)
- u[2] : Sfa = long chain fatty acids (LCFA) (kg COD/m3)
- u[3] : Sva = total valerate (kg COD/m3)
- u[4] : Sbu = total butyrate (kg COD/m3)
- u[5] : Spro = total propionate (kg COD/m3)
- u[6] : Sac = total acetate (kg COD/m3)
- u[7] : Sh2 = hydrogen gas (kg COD/m3)
- u[8] : Sch4 = methane gas (kg COD/m3)
- u[9] : Sic = inorganic carbon (kmole C/m3)
- u[10] : Sin = inorganic nitrogen (kmole N/m3)
- u[11] : Si = soluble inerts (kg COD/m3)
- u[12] : Xc = composites (kg COD/m3)
- u[13] : Xch = carbohydrates (kg COD/m3)
- u[14] : Xpr = proteins (kg COD/m3)
- u[15] : Xli = lipids (kg COD/m3)
- u[16] : Xsu = sugar degraders (kg COD/m3)
- u[17] : Xaa = amino acid degraders (kg COD/m3)
- u[18] : Xfa = LCFA degraders (kg COD/m3)
- u[19] : Xc4 = valerate and butyrate degraders (kg COD/m3)
- u[20] : Xpro = propionate degraders (kg COD/m3)
- u[21] : Xac = acetate degraders (kg COD/m3)
- u[22] : Xh2 = hydrogen degraders (kg COD/m3)
- u[23] : Xi = particulate inerts (kg COD/m3)
- u[24] : scat+ = cations (metallic ions, strong base) (kmole/m3)
- u[25] : san- = anions (metallic ions, strong acid) (kmole/m3)
- u[33] in Matlab : pH from the pH delay block
- u[34] in Matlab : wastewater temperature into the ASM2ADM interface, deg C
Output
Matlab output
- y[0] : Si = soluble inert organic material (g COD/m3)
- y[1] : Ss = readily biodegradable substrate (g COD/m3)
- y[2] : Xi = particulate inert organic material (g COD/m3)
- y[3] : Xs = slowly biodegradable substrate (g COD/m3)
- y[4] : Xbh = active heterotrophic biomass (g COD/m3)
- y[5] : Xba = active autotrophic biomass (g COD/m3)
- y[6] : Xp = particulate product arising from biomass decay (g COD/m3)
- y[7] : So = oxygen (g -COD/m3)
- y[8] : Sno = nitrate and nitrite nitrogen (g N/m3)
- y[9] : Snh = ammonia and ammonium nitrogen (g N/m3)
- y[10] : Snd = soluble biogradable organic nitrogen (g N/m3)
- y[11] : Xnd = particulate biogradable organic nitrogen (g N/m3)
- y[12] : Salk = alkalinity (mole HCO3-/m3)
- y[13] : TSS = total suspended solids (internal use) (mg SS/l)
- y[14] : flow rate (m3/d)
- y[15] : temperature (deg C)
Collimator output
- Q
- T
- Soluble: Si, Ss, So, Sno, Snh, Snd, Salk
- Particulate: Xi, Xs, Xbh, Xba, Xp, Xnd, TSS